{% extends "base.html" %}
{% comment %}
Copyright 2010 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}

{% load i18n %}
{% block title-extra %}
  {{person.first_name}} {{person.last_name}} -
{% endblock %}
{% block head-extra %}
<script type="text/javascript">
function set_display(id_or_elem, hide) {
  var hide_text = hide ? 'none' : '';
  if (typeof(id_or_elem) == 'string') {
    document.getElementById(id_or_elem).style.display = hide_text;
  } else {
    id_or_elem.style.display = hide_text;
  }
}

function hide_unhide_note_contents(note_contents_id) {
  var note = document.getElementById(note_contents_id + '-contents');
  var hidden = note.style.display == 'none';
  set_display(note, !hidden);
  set_display('reveal-note', hidden);
  set_display('hide-note', !hidden);
  set_display(note_contents_id + '-mark-not-spam', !hidden);
}
</script>
{% endblock %}
{% block content %}
{% if not standalone %}
  {% include "map.html" %}
{% endif %}
<form method="post" action="/view">
  {{env.subdomain_field_html|safe}}
  <input type="hidden" name="id" value="{{person.record_id}}">
  <input type="hidden" name="query" value="{{params.query}}">
  <table class="view" cellpadding="0" cellspacing="0">
    <tr class="columns">
      <td class="column">
        <table class="person column" cellpadding="0" cellspacing="0">
          <tr>
            <td>
              <h2>{% trans "Identifying information" %}</h2>
              <table class="person display" cellpadding="0" cellspacing="0">
                <tr>
                  <td class="name section">
                    <h3>{% trans "Name" %}</h3>
                    <table class="fields">
                      {% if env.use_family_name and env.family_name_first %}
                        <tr>
                          <td class="label">{% trans "Family name" %}:</td>
                          <td class="field">{{person.last_name}}</td>
                        </tr>
                      {% endif %}
                        <tr>
                          <td class="label">
                            {% if env.use_family_name %}
                              {% trans "Given name" %}:
                            {% else %}
                              {% trans "Name" %}:
                            {% endif %}
                          </td>
                          <td class="field">{{person.first_name}}</td>
                        </tr>
                      {% if env.use_family_name and not env.family_name_first %}
                        <tr>
                          <td class="label">{% trans "Family name" %}:</td>
                          <td class="field">{{person.last_name}}</td>
                        </tr>
                      {% endif %}
                    </table>
                  </td>
                </tr>
                <tr>
                  <td class="physical section">
                    <h3>{% trans "Physical characteristics" %}</h3>
                    <table class="fields">
                      <tr>
                        <td class="label">{% trans "Sex" %}:</td>
                        <td class="field">{{person.sex_text}}</td>
                      </tr>
                      {% comment %}
                      Don't show the date of birth in the UI for now.
                      <tr>
                        <td class="label">{% trans "Date of birth" %}:</td>
                        <td class="field">{{person.date_of_birth}}</td>
                      </tr>
                      {% endcomment %}
                      <tr>
                        <td class="label">{% trans "Age" %}:</td>
                        <td class="field">{{person.age}}</td>
                      </tr>
                    </table>
                  </td>
                </tr>
                <tr>
                  <td class="address section">
                    <h3>{% trans "Home address" %}</h3>
                    <table class="fields">
                      <tr>
                        <td class="label">{% trans "Street name" %}:</td>
                        <td class="field">{{person.home_street}}</td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "Neighborhood" %}:</td>
                        <td class="field">{{person.home_neighborhood}}</td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "City" %}:</td>
                        <td class="field">{{person.home_city}}</td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "Province or state" %}:</td>
                        <td class="field">{{person.home_state}}</td>
                      </tr>
                      {% if env.use_postal_code %}
                        <tr>
                          <td class="label">{% trans "Postal or zip code" %}:</td>
                          <td class="field">{{person.home_postal_code}}</td>
                        </tr>
                      {% endif %}
                      <tr>
                        <td class="label">{% trans "Home country" %}:</td>
                        <td class="field">{{person.home_country}}</td>
                      </tr>
                    </table>
                  </td>
                </tr>
                {% if person.other %}
                <tr>
                  <td class="other section">
                    <h3>{% trans "Other information" %}</h3>
                    <table class="fields">
                      <tr>
                        <td>
                          <textarea readonly="readonly" cols=40 rows=5
                            >{{person.other}}</textarea>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
                {% endif %}
                {% if person.photo_url %}
                <tr>
                  <td class="photo section">
                    <h3>{% trans "Photo" %}</h3>
                    <table class="fields">
                      <tr>
                        <td>
                          <a href="{{person.photo_url}}">
                            <img src="{{person.photo_url}}"
                                class="photo">
                          </a>
                        </td>
                      </tr>
                    </table>
                  </td>
                </tr>
                {% endif %}
                <tr>
                  <td class="source section">
                    <h3>{% trans "Source of this record" %}</h3>
                    <table class="fields">
                      <tr>
                        <td class="label">{% trans "Author's name" %}:</td>
                        <td class="field">{{person.author_name}}</td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "Author's phone number" %}:</td>
                        <td class="field">
                          {% if show_private_info %}
                            {{person.author_phone}}</td>
                          {% else %}
                            {% if person.author_phone %}
                              <a href="{{reveal_url}}">
                                {% trans "(click to reveal)" %}</a>
                            {% endif %}
                          {% endif %}
                        </td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "Author's e-mail address" %}:</td>
                        <td class="field">
                          {% if show_private_info %}
                            {{person.author_email}}
                          {% else %}
                            {% if person.author_email %}
                              <a href="{{reveal_url}}">
                                {% trans "(click to reveal)" %}</a>
                            {% endif %}
                          {% endif %}
                        </td>
                      </tr>
                      {% if person.is_clone or person.source_url or person.source_date or person.source_name %}
                      <tr>
                        <td class="label">{% trans "Original URL" %}:</td>
                        <td class="field">
                          <a href="{{person.source_url}}"
                            >{% trans "Link" %}</a>
                        </td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "Original posting date" %}:</td>
                        <td class="field">{{person.source_date|date:"Y-m-d H:i \U\T\C"}}</td>
                      </tr>
<!-- Expiry is not fully implemented yet; hide it from the UI for now. -->
                      <tr style="display: none">
                        <td class="label">{% trans "Expiry date of this record" %}:</td>
                        <td class="field">{{person.expiry_date|date:"Y-m-d H:i \U\T\C"}}</td>
                      </tr>
                      <tr>
                        <td class="label">{% trans "Original site name" %}:</td>
                        <td class="field">{{person.source_name}}</td>
                      </tr>
                      {% endif %}
                    </table>
                    <div class="tracking">
                      ID: {{person.record_id}}
                    </div>
                  </td>
                </tr>
                {% if linked_person_info %}
                <tr>
                  <td class="other section">
                    <h3>{% trans "Possible duplicates" %}</h3>
                    <table class="fields">
                    {% for linked_person in linked_person_info %}
                      <tr>
                        <td>
                          <a href="{{linked_person.view_url}}">
                            {{linked_person.name}}
                          </a>
                          <span class="tracking">
                            ({{linked_person.id}})
                          </span>
                        </td>
                      </tr>
                      {% endfor %}
                      {% if not params.dupe_notes %}
                      <tr>
                        <td><a href="{{dupe_notes_url}}">
                            Show who marked these duplicates
                        </a></td>
                      </tr>
                      {% endif %}
                    </table>
                  </td>
                </tr>
                {% endif %}
              </table>
            </td>
          </tr>
          <tr>
            <td>
              <a href="{{subscribe_url}}">
                <input type="button"
          	  value="{% trans "Subscribe to updates about this person" %}"
                  id="subscribe_btn"></a>
            </td>
          </tr>
        </table>
        <p>
        {% if params.query or params.first_name or params.last_name %}
          <a href="{{results_url}}">
            {{env.back_chevron}} {% trans "Back to results list" %}
          </a>
        {% else %}
          <a href="{{env.main_url}}">
            {{env.back_chevron}} {% trans "Back to start" %}
          </a>
        {% endif %}

      </td>
      <td class="column">
        {% if notes %}
          <h2>{% trans "Status updates for this person" %}
            <a href="{{feed_url}}"
               title="{% trans "Feed of updates about this person" %}">
              <img src="/static/feed-icon.png">
            </a>
          </h2>
          {% for note in notes %}
          {% if params.dupe_notes or not note.linked_person_record_id %}
            {% include "note.html" %}
          {% endif %}
          {% endfor %}
        {% else %}
          <h2>{% trans "No status updates have been posted" %}
            <a href="{{feed_url}}"
               title="{% trans "Feed of updates about this person" %}">
              <img src="/static/feed-icon.png">
            </a>
          </h2>
        {% endif %}
        <p>
        {% include "add_note.html" %}
      </td>
    </tr>
  </table>
</form>
<form method="get" action="/delete">
  {{env.subdomain_field_html|safe}}
  <input type="hidden" name="id" value="{{person.record_id}}">
  <input type="submit" value="{% trans "Delete this record" %}">
</form>
<p>
<div class="custom-message">
  {{env.view_page_custom_html|default:""|safe}}
</div>
{% endblock %}
{% block footer %}{# Explicitly remove Back to Start from bottom of page.#}{% endblock %}
